package com.ruoyi.web.controller.baodao.controller;

import com.ruoyi.baodao.entity.Check;
import com.ruoyi.baodao.entity.MFGoods9999;
import com.ruoyi.baodao.entity.MFGoods9999Example;
import com.ruoyi.baodao.mapper.BDMapper;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.DataSourceType;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 对账
 */
@Slf4j
@Controller
@RequestMapping("baodao/check")
public class CheckController extends BaseController {
    @Autowired
    BDMapper bdMapper;
    private String prefix = "baodao/check";

    @GetMapping()
    public String operlog()
    {
        return prefix + "/check";
    }

    // 查询 商品主档
    /**
     * 药品主档
     */
    @PostMapping("/list")
    @ResponseBody
    @DataSource(value = DataSourceType.SLAVE)
    public TableDataInfo list(Check check, String flag)

    {

        logger.info("查询对账表，时间参数：" + check.getEndTime());
        // 获取 用户名 和  用户 部门
        // List<MFGoodsLink> mfGoodsLinks = mfGoodsLinkMapper.selectByExample(new MFGoodsLinkExample());
        startPage(); //分页
        List<Check> checks =  bdMapper.queryCheck(check.getEndTime());

       return getDataTable(checks);

    }

}
